package engine.control
{
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;
	
	import newx.BaseObject;

	public class BaseItem extends BaseObject
	{
		private var _label		:String;
		
		private var _data		:Object;
		
		private var _id		:int;
		
		private var _view		:DisplayObject;
		
//		private var _item		:ButtonEx;
		
		private var _extraData	:Object;
		
		private var _icon		:String	=	"";
		
		private var _color     :uint =0;
		
		public function BaseItem(labelStr:String,itemData:Object,addView:DisplayObject = null,icon:String="",color:uint =0)
		{
			_color      =   color;
			_icon		=	icon;
			_label		=	labelStr;
			_data		=	itemData;
			_view		=	addView;
			_extraData	=	new Object();
		}
		
//		public function set item(btn:ButtonEx):void
//		{
//			_item	=	btn;
//			if(_color != 0)_item.color = _color;
//			
//			_item.addEventListener(MouseEvent.CLICK,clickHandle);
//		}
		
		private function clickHandle(e:MouseEvent):void
		{
				//dispatchEvent(new ControlEvent(ControlEvent.CLICK_ITEM));
		}
		
//		public function get item():ButtonEx
//		{
//			return _item;
//		}
		
		public function get label():String
		{
			return _label;
		}
		
		public function set label(str:String):void
		{
			_label	=	str;
		}
		
		public function set data(val:Object):void
		{
			_data	=	val;
		}
		public function get data():Object
		{
			return _data;
		}
		
		public function get view():DisplayObject
		{
			return _view;
		}
		public function set id(val:int):void
		{
			_id		=	val;
		}
		public function get id():int
		{
			return	_id;
		}
		public function clear():void
		{
			_label		=	"";
			_data		=	null;
			_view		=	null;
//			_item.text	=	_label;
//			_item.removeEventListener(MouseEvent.CLICK,clickHandle);
		}

		public function get extraData():Object
		{
			return _extraData;
		}

		public function set extraData(value:Object):void
		{
			_extraData = value;
		}

		public function get icon():String
		{
			return _icon;
		}

		public function set icon(value:String):void
		{
			_icon = value;
		}


	}
}